

//int heighttree(TreeNode* pRoot)
//{
//    if (pRoot == nullptr)
//        return 0;
//    int leftheight = heighttree(pRoot->left);
//    int rightheight = heighttree(pRoot->right);
//
//
//    return leftheight > rightheight ? leftheight + 1 : rightheight + 1;
//}
//
//
//
//bool IsBalanced_Solution(TreeNode* pRoot) {
//    // write code here
//    if (pRoot == nullptr)
//        return true;
//    int left = heighttree(pRoot->left);
//    int right = heighttree(pRoot->right);
//    return abs(right - left) <= 1 && IsBalanced_Solution(pRoot->left) && IsBalanced_Solution(pRoot->right);
//
//
//
//
//
//
//
//
//
//
//
//
//}
//};
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int n;
    cin >> n;
    string str;
    cin >> str;
    int size = str.size() / 2;
    int left = 0;
    int right = left + size - 1;
    int count0 = 0;
    int count1 = 0;
    long long ret = 0;
    for (int i = 0; i < str.size(); i++)
    {
        if (str[i] == '0')
            count0++;
        if (str[i] == '1')
            count1++;

    }
    while (right < str.size() - 1)
    {
        int sum0 = 0;
        int sum1 = 0;

        for (int i = left; i <= right; i++)
        {
            if (str[i] == '0')
                sum0++;
            if (str[i] == '1')
                sum1++;
        }
        if (sum0 == count0 / 2 && sum1 == count1 / 2)
        {
            ret += 2;
        }
        left++;
        right = left + size - 1;

    }
    cout << ret;


}    bool used[210] = { false };
int ret;
void dfs(vector<vector<int> >& m, int pos)
{
    used[pos] = true;
    for (int i = 0; i < m.size(); i++)
    {
        if (!used[i] && m[pos][i])
        {
            dfs(m, i);
        }




    }








}
int citys(vector<vector<int> >& m) {
    // write code here
    int n = m.size();
    for (int i = 0; i < n; i++)
    {

        if (!used[i])
        {
            ret++;
            dfs(m, i);
        }



    }
    return ret;













}
};
#include <iostream>
#include<algorithm>
#include<unordered_set>
using namespace std;

int main() {
    int n;
    unordered_set <string> st;

    cin >> n;
    while (n--)
    {
        string str;
        cin >> str;
        sort(str.begin(), str.end());
        st.insert(str);

    }
    cout << st.size();









}